import { Admin,
  NotFound,
  NoAuthority} from '@pages'

  //导入设置图标需要的插件
  import {
    PieChartOutlined,
    UnorderedListOutlined,
    SettingOutlined ,
    MessageOutlined
  } from '@ant-design/icons'
  
  //导入路由懒加载插件
  import Loadable from 'react-loadable'
  //导入遮罩层加载组件Loading
  import Loading from "@pages/Loading"


  //创建基础路由login admin 404

  const basicRoute=[
  {
    path:"/login",
    name:"登录页",
  	component: Loadable({
 			loader: () => import('@pages/Login'),
 			loading: Loading,
 		})
  },
  {
    path:"/admin",
    name:"主页",
    component:Admin
  },
  {
    path:"/404",
    name:"未找到",
    component:NotFound
  }
]

//创建依赖于admin的二级路由组件
const adminRoute=[
  {
    path:"/admin/dashBoard",
    name:"仪表盘页",
    component: Loadable({
      loader: () => import('@pages/DashBoard'),
      loading: Loading,
    }),
    icon:PieChartOutlined,
    meta:{
      isNav:true,
      roles:["admin","superAdmin","editor"]
    }
  },
  {
    path:"/admin/artAdd",
    name:"添加文章",
    component: Loadable({
      loader: () => import('@pages/ArtAdd'),
      loading: Loading,
    }),
    meta:{
      isNav:false,
      roles:["admin","superAdmin","editor"]
    }
  },
  {
    path:"/admin/artEdit/:id",
    name:"文章编辑",
    component: Loadable({
      loader: () => import('@pages/ArtEdit'),
      loading: Loading,
    }),
    meta:{
      isNav:false,
      roles:["admin","superAdmin","editor"]
      
    }
  },
  {
    path:"/admin/artList",
    name:"文章列表",
    component: Loadable({
      loader: () => import('@pages/ArtList'),
      loading: Loading,
    }),
    icon:UnorderedListOutlined,
    meta:{
      isNav:true,
      roles:["admin","superAdmin","editor"]
    }
  },
  {
    path:"/admin/message",
    name:"消息中心",
    component: Loadable({
      loader: () => import('@pages/Message'),
      loading: Loading,
    }),
    icon:MessageOutlined,
    meta:{
      isNav:true,
      roles:["admin","superAdmin","editor"]
    }
  },
  {
    path:"/admin/settings",
    name:"设置",
    component: Loadable({
      loader: () => import('@pages/Settings'),
      loading: Loading,
    }),
    icon:SettingOutlined,
    meta:{
      isNav:true,
      roles:["superAdmin","editor","admin"]
    }
  },
  {
    path:"/admin/noAuthority",
    name:"没有权限",
    component:NoAuthority,
    meta:{
      isNav:false,
      roles:["admin","superAdmin","editor"]
    }
  },
  {
    path:"/admin/404",
    name:"未找到",
    component:NotFound,
    meta:{
      isNav:false,
      roles:["admin","superAdmin","editor"]
    }
  }
]

//导出路由规则，路由配置
export {
  basicRoute,
  adminRoute
}